import request from '@/config/axios'

// 协议规则 VO
export interface AgreementVO {
  id: number | string // 唯一编号
  identify: string // 标识
  title: string // 标题
  content: string // 内容
}

// 协议规则 API
export const AgreementApi = {
  // 查询协议规则分页
  getAgreementPage: async (params: any) => {
    return await request.get({ url: `/cms/agreement/page`, params })
  },

  // 查询协议规则详情
  getAgreement: async (id: number | string) => {
    return await request.get({ url: `/cms/agreement/get?id=` + id })
  },

  // 新增协议规则
  createAgreement: async (data: AgreementVO) => {
    return await request.post({ url: `/cms/agreement/create`, data })
  },

  // 修改协议规则
  updateAgreement: async (data: AgreementVO) => {
    return await request.post({ url: `/cms/agreement/update`, data })
  },

  // 删除协议规则
  deleteAgreement: async (id: number | string) => {
    return await request.get({ url: `/cms/agreement/delete?id=` + id })
  },

  // 导出协议规则 Excel
  exportAgreement: async (params) => {
    return await request.download({ url: `/cms/agreement/export-excel`, params })
  }
}
